package com.itheima.test05;

import java.util.Arrays;

public class Test {//冒泡排序
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        int[] arr = {9, 5, 2, 7};

        for (int j = 0; j < arr.length; j++) {
            for (int i = 0; i < arr.length - 1 - j; i++) {
                if (arr[i] > arr[i + 1]) {
                    int temp = arr[i];
                    arr[i] = arr[i + 1];
                    arr[i + 1] = temp;
                }
            }
        }

        for(int i = 0 ;i<100000;i++){

        }

        long end = System.currentTimeMillis();
        System.out.println("程序持续了"+(end - start));
        System.out.println(Arrays.toString(arr));
    }
}
